import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
public abstract class User {
    protected String userId;
    protected String userName;
    protected String phone;
    protected String password;
    protected LocalDateTime regTime;
    protected String role; // ADMIN, MANAGER, FRONT

    User(String userId, String userName, String phone, String password, LocalDateTime regTime, String role) {
        this.userId = userId;
        this.userName = userName;
        this.phone = phone;
        this.password = password;
        this.regTime = regTime;
        this.role = role;
    }

    public String getUserId() { return userId; }
    public String getUserName() { return userName; }
    public String getPhone() { return phone; }
    public String getPassword() { return password; }
    public LocalDateTime getRegTime() { return regTime; }
    public String getRole() { return role; }

    public void setPhone(String phone) { this.phone = phone; }
    public void setPassword(String password) { this.password = password; }
    public void setRole(String role) { this.role = role; }

    public void setRegTime(LocalDateTime t) { this.regTime = t; }

    @Override
    public String toString() {
        return String.format("ID:%s  用户名:%s  手机:%s  角色:%s  注册:%s",
                userId, userName, phone, role, regTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")));
    }
}
